package com.weetop.aklyscan.presenter;

import android.app.Activity;

import com.weetop.aklyscan.base.mvp.BaseModel;
import com.weetop.aklyscan.base.mvp.BaseObserver;
import com.weetop.aklyscan.base.mvp.BasePresenter;
import com.weetop.aklyscan.bean.SearchBean;
import com.weetop.aklyscan.bean.SerailBean;
import com.weetop.aklyscan.bean.SerailBean1;
import com.weetop.aklyscan.view.SearchView;

public class SearchPresent extends BasePresenter<SearchView> {

    public SearchPresent(SearchView baseView, Activity activity) {
        super(baseView, activity);
    }

    public void serail1(String keywords) {
        addDisposable(apiServer.serail1("1", keywords, "1", "1"),
                new BaseObserver<BaseModel<SerailBean>>(baseView) {
                    @Override
                    public void onSuccess(BaseModel<SerailBean> o) {
                        baseView.getserailSuccess(o);
                    }

                    @Override
                    public void onError(String msg) {
                        if (baseView != null) {
                            baseView.showError(msg);
                        }
                    }
                });
    }

    public void Into54(String type, String keywords, String order_sn, String page) {
        addDisposable(apiServer.Into54(type, keywords, order_sn, page, "10"), new BaseObserver<BaseModel<SerailBean1>>(baseView) {
            @Override
            public void onSuccess(BaseModel<SerailBean1> o) {
                baseView.getserail1Success(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }

    public void Into62(String type, String keywords) {
        addDisposable(apiServer.Into62(keywords, "1", "1000", type), new BaseObserver<BaseModel<SearchBean>>(baseView) {
            @Override
            public void onSuccess(BaseModel<SearchBean> o) {
                baseView.getInto62Success(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }


    public void Into55(String type, String keywords, String page) {
        addDisposable(apiServer.Into55(type, keywords, page, "10"), new BaseObserver<BaseModel<SerailBean1>>(baseView) {
            @Override
            public void onSuccess(BaseModel<SerailBean1> o) {
                baseView.getserail2Success(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }

    public void Into56(String type,String type1, String keywords, String page) {
        addDisposable(apiServer.Into56(type, keywords, page, type1,"10"), new BaseObserver<BaseModel<SerailBean1>>(baseView) {
            @Override
            public void onSuccess(BaseModel<SerailBean1> o) {
                baseView.getserail3Success(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }

    public void Into57(String type,String type_two,String type_two_status, String order_sn, String keywords) {
        addDisposable(apiServer.Into57(type, type_two, type_two_status, order_sn, keywords, "1","10000"), new BaseObserver<BaseModel<SerailBean1>>(baseView) {
            @Override
            public void onSuccess(BaseModel<SerailBean1> o) {
                baseView.getInto57Success(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }
}
